package com.ibeetl.admin.core.dao;

import java.util.List;

import org.beetl.sql.core.annotatoin.Param;
import org.beetl.sql.core.annotatoin.Sql;
import org.beetl.sql.core.annotatoin.SqlResource;
import org.beetl.sql.core.mapper.BaseMapper;
import org.beetl.sql.core.engine.PageQuery;

import  com.ibeetl.admin.core.entity.*;

/**
 * CoreLog Dao
 */
@SqlResource("core.coreLog")
public interface CoreLogDao extends BaseMapper<CoreLog>{
    public PageQuery<CoreLog> queryByCondition(PageQuery query);
    public void batchDelCoreLogByIds( List<Long> ids);
    
    //某个时间段IP地址的访问数
    @Sql("select count(*) from core_log z where z.article_id = ? and z.create_time > ? and ip = ? and type = ?")
    public Integer validateLog(@Param(value="article_id")Long articleId, @Param(value="create_time")String createTime, @Param(value="ip")String ip, @Param(value="type")String type);
    
    //某个时间段IP地址的访问数
    @Sql("select count(*) from core_log z where z.article_id = ? and z.create_time > ? and ip = ? and type = ? and user_id = ?")
    public Integer validateLog(@Param(value="article_id")Long articleId, @Param(value="create_time")String createTime, @Param(value="ip")String ip, @Param(value="type")String type, @Param(value="userId")Long userId);
}